<%@page import="com.google.appengine.api.datastore.Text"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="com.google.appengine.api.datastore.Entity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String baseUrl = "http://gaedlab.appspot.com";
	Entity qrEntity = (Entity) request.getAttribute("qrEntity");
	Boolean qrShow = (Boolean) request.getAttribute("qrShow");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>QR-Code</title>
<style>
	#qrTable * {padding: 0; marggin: 0;}
	#qrTable {border-spacing: 0px;}
	#qrTable tr {height: 6px;}
	#qrTable tr td {width: 6px;}
	#qrTable tr td.black {background-color: #000000}
	#qrTable tr td.white {background-color: #ffffff}
</style>
</head>
<body>
	<%if(Boolean.TRUE.equals(qrShow) && qrEntity != null) { %>
		<img src="http://chart.apis.google.com/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=<%=URLEncoder.encode(baseUrl + "/qr/showText?id=" + qrEntity.getKey().getId(), "UTF-8") %>"/>
		<img src="http://chart.apis.google.com/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=<%=URLEncoder.encode(baseUrl + "/qr/show?id=" + qrEntity.getKey().getId(), "UTF-8") %>"/>
		<a href="<%=baseUrl + "/qr/showText?id=" + qrEntity.getKey().getId() %>" target="_blank">查看<%=qrEntity.getKey().getId() %></a>
	<%} %>
	<form action="<%=request.getContextPath() %>/qr/create" method="post">
	<textarea style="width: 100%; height: 300px;" name="text"><%=qrEntity == null || qrEntity.getProperty("text") == null ? "" : ((Text)qrEntity.getProperty("text")).getValue() %></textarea>
	<input type="submit" />
	</form>
</body>
</html>